package kafka.examples

/**
  * Created by hunter on 17-11-19.
  * ok
  *
  * ./bin/kafka-console-consumer --bootstrap-server 10.100.189.30:9092 --consumer-property key.deserializer=org.apache.kafka.common.serialization.IntegerDeserializer --consumer-property value.deserializer=org.apache.kafka.common.serialization.StringDeserializer   --property print.key=true --topic topic1 --from-beginning
  *
  * the key.serializer is notworking , need more study
  *  ./bin/kafka-console-producer --broker-list 10.100.189.30:9092  --producer-property key.serializer=org.apache.kafka.common.serialization.IntegerSerializer --producer-property value.serializer=org.apache.kafka.common.serialization.StringSerializer  --property key.separator=: --property parse.key=true  --topic topic1
  */
object KafkaConsumerProducerDemo {
  def main(args:Array[String]):Unit = {
     val isAsync = args.length == 0 || !args(0).trim.equalsIgnoreCase("sync")

    val producerThread = new Producer(KafkaProperties.TOPIC,isAsync)
    producerThread.start()


    val consumerThread = new Consumer(KafkaProperties.TOPIC)
    consumerThread.start()

  }
}
